package simplefactory

import "fmt"

type API interface {
	Say(name string) string
}

func NewAPI(typeName string) API {
	switch typeName {
		case "hi":  return &hiSay{} 

		case "hello":  return &helloSay{} 
	}
	return nil
}

type hiSay struct {}

func (*hiSay) Say(name string) string  {
	return fmt.Sprintf("Hi,%s",name)
}

type helloSay struct{}
func (*helloSay)Say(name string) string {
	return fmt.Sprintf("Hello,%s",name)
}

